home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / fire_it_.swf / scripts / __Packages / #26.as < prev    next >
Encoding:
Text File  |  2011-03-26  |  11.8 KB  |  454 lines

  1. class ┬º#26┬º
  2. {
  3.    static var ┬º#95┬º = false;
  4.    var currentMusic = 0;
  5.    var ┬º#77┬º = 50;
  6.    var musicVolume = 50;
  7.    var ┬º#32┬º = false;
  8.    var ┬º#39┬º = false;
  9.    function ┬º#26┬º(┬º#385┬º)
  10.    {
  11.       eval("#26").instance = this;
  12.       _root.createEmptyMovieClip("sfxMC",_root.getNextHighestDepth());
  13.       _root.createEmptyMovieClip("musicMC",_root.getNextHighestDepth());
  14.       if(eval("#26")["#95"])
  15.       {
  16.          eval("#0").log(this["#2"]() + "created " + this.toString());
  17.       }
  18.       if(┬º#385┬º != undefined)
  19.       {
  20.          this["#339"](┬º#385┬º);
  21.       }
  22.    }
  23.    static function getInstance()
  24.    {
  25.       if(eval("#26").instance == null)
  26.       {
  27.          eval("#26").instance = new ┬º#26┬º();
  28.       }
  29.       return eval("#26").instance;
  30.    }
  31.    function ┬º#2┬º()
  32.    {
  33.       return "SoundManager:  ";
  34.    }
  35.    function toString(┬º#405┬º)
  36.    {
  37.       var _loc2_ = "[SoundManager ";
  38.       _loc2_ += "sfx: " + this["#77"];
  39.       if(this["#32"])
  40.       {
  41.          _loc2_ += "(muted) ";
  42.       }
  43.       _loc2_ += ", music: " + this.musicVolume;
  44.       if(this["#39"])
  45.       {
  46.          _loc2_ += "(muted) ";
  47.       }
  48.       _loc2_ += ", sounds: " + this["#12"].length;
  49.       if(┬º#405┬º)
  50.       {
  51.          _loc2_ += "\nMusic:";
  52.          _loc2_ += "\n  " + this["#15"].join("\n  ") + "\n";
  53.          _loc2_ += "\nSound:";
  54.          _loc2_ += "\n  " + this["#12"].join("\n  ") + "\n";
  55.       }
  56.       _loc2_ += "]";
  57.       return _loc2_;
  58.    }
  59.    function ┬º#339┬º(names, ┬º#288┬º, append)
  60.    {
  61.       if(names == undefined || names.length < 1)
  62.       {
  63.          return undefined;
  64.       }
  65.       if(┬º#288┬º == undefined)
  66.       {
  67.          ┬º#288┬º = "#385";
  68.       }
  69.       var _loc6_ = new Array(names.length);
  70.       var _loc3_ = 0;
  71.       while(_loc3_ < names.length)
  72.       {
  73.          _loc6_[_loc3_] = new ┬º#27┬º(_root.sfxMC);
  74.          var _loc4_ = !this["#32"] ? this["#77"] : 0;
  75.          _loc6_[_loc3_].loadSound(┬º#288┬º,names[_loc3_],_loc4_);
  76.          _loc3_ = _loc3_ + 1;
  77.       }
  78.       if(append)
  79.       {
  80.          this["#12"] = this["#12"].concat(_loc6_);
  81.          this["#38"] = this["#38"].concat(names);
  82.       }
  83.       else
  84.       {
  85.          this["#12"] = _loc6_;
  86.          this["#38"] = names;
  87.       }
  88.    }
  89.    function ┬º#316┬º(names, append)
  90.    {
  91.       if(names == undefined || names.length < 1)
  92.       {
  93.          return undefined;
  94.       }
  95.       var _loc6_ = new Array(names.length);
  96.       var _loc3_ = 0;
  97.       while(_loc3_ < names.length)
  98.       {
  99.          _loc6_[_loc3_] = new ┬º#27┬º(_root.sfxMC);
  100.          var _loc4_ = !this["#32"] ? this["#77"] : 0;
  101.          _loc6_[_loc3_].attachSound(names[_loc3_],_loc4_);
  102.          _loc3_ = _loc3_ + 1;
  103.       }
  104.       if(append && this["#12"] != undefined)
  105.       {
  106.          this["#12"] = this["#12"].concat(_loc6_);
  107.          this["#38"] = this["#38"].concat(names);
  108.       }
  109.       else
  110.       {
  111.          this["#12"] = _loc6_;
  112.          this["#38"] = names;
  113.       }
  114.       if(eval("#26")["#95"])
  115.       {
  116.          eval("#0").log(this["#2"]() + "attached sounds: " + this.toString(true));
  117.       }
  118.    }
  119.    function ┬º#427┬º(names, ┬º#288┬º, append)
  120.    {
  121.       if(names == undefined || names.length < 1)
  122.       {
  123.          return undefined;
  124.       }
  125.       if(┬º#288┬º == undefined)
  126.       {
  127.          ┬º#288┬º = "music";
  128.       }
  129.       var _loc6_ = new Array(names.length);
  130.       var _loc3_ = 0;
  131.       while(_loc3_ < names.length)
  132.       {
  133.          _loc6_[_loc3_] = new ┬º#27┬º(_root.musicMC);
  134.          var _loc4_ = !this["#39"] ? this.musicVolume : 0;
  135.          _loc6_[_loc3_].loadSound(┬º#288┬º,names[_loc3_],_loc4_);
  136.          _loc3_ = _loc3_ + 1;
  137.       }
  138.       if(append)
  139.       {
  140.          this["#15"] = this["#15"].concat(_loc6_);
  141.          this["#66"] = this["#66"].concat(names);
  142.       }
  143.       else
  144.       {
  145.          this["#15"] = _loc6_;
  146.          this["#66"] = names;
  147.       }
  148.    }
  149.    function ┬º#322┬º(names, append)
  150.    {
  151.       if(names == undefined || names.length < 1)
  152.       {
  153.          return undefined;
  154.       }
  155.       var _loc6_ = new Array(names.length);
  156.       var _loc3_ = 0;
  157.       while(_loc3_ < names.length)
  158.       {
  159.          _loc6_[_loc3_] = new ┬º#27┬º(_root.musicMC);
  160.          var _loc4_ = !this["#39"] ? this.musicVolume : 0;
  161.          _loc6_[_loc3_].attachSound(names[_loc3_],_loc4_);
  162.          _loc3_ = _loc3_ + 1;
  163.       }
  164.       if(append && this["#12"] != undefined)
  165.       {
  166.          this["#15"] = this["#15"].concat(_loc6_);
  167.          this["#66"] = this["#66"].concat(names);
  168.       }
  169.       else
  170.       {
  171.          this["#15"] = _loc6_;
  172.          this["#66"] = names;
  173.       }
  174.    }
  175.    function setSoundVolume(┬º#106┬º)
  176.    {
  177.       ┬º#106┬º = Math.round(┬º#106┬º);
  178.       if(┬º#106┬º < 0)
  179.       {
  180.          ┬º#106┬º = 0;
  181.       }
  182.       else if(┬º#106┬º > 100)
  183.       {
  184.          ┬º#106┬º = 100;
  185.       }
  186.       this["#77"] = ┬º#106┬º;
  187.       if(!this["#32"])
  188.       {
  189.          var _loc2_ = 0;
  190.          while(_loc2_ < this["#12"].length)
  191.          {
  192.             this["#12"][_loc2_].setVolume(┬º#106┬º);
  193.             _loc2_ = _loc2_ + 1;
  194.          }
  195.       }
  196.    }
  197.    function getSoundVolume()
  198.    {
  199.       if(this["#32"])
  200.       {
  201.          return 0;
  202.       }
  203.       return this["#77"];
  204.    }
  205.    function setMusicVolume(┬º#106┬º)
  206.    {
  207.       ┬º#106┬º = Math.round(┬º#106┬º);
  208.       if(┬º#106┬º < 0)
  209.       {
  210.          ┬º#106┬º = 0;
  211.       }
  212.       else if(┬º#106┬º > 100)
  213.       {
  214.          ┬º#106┬º = 100;
  215.       }
  216.       this.musicVolume = ┬º#106┬º;
  217.       if(!this["#39"])
  218.       {
  219.          this["#15"][this.currentMusic].setVolume(┬º#106┬º);
  220.       }
  221.    }
  222.    function getMusicVolume()
  223.    {
  224.       if(this["#39"])
  225.       {
  226.          return 0;
  227.       }
  228.       return this.musicVolume;
  229.    }
  230.    function ┬º#353┬º(┬º#46┬º)
  231.    {
  232.       this["#32"] = true;
  233.       var _loc2_ = 0;
  234.       while(_loc2_ < this["#12"].length)
  235.       {
  236.          if(this["#12"][_loc2_]["#34"] && this["#12"][_loc2_].getVolume() > 0)
  237.          {
  238.             this["#12"][_loc2_]["#64"](0,┬º#46┬º);
  239.          }
  240.          _loc2_ = _loc2_ + 1;
  241.       }
  242.    }
  243.    function ┬º#352┬º(┬º#46┬º)
  244.    {
  245.       this["#39"] = true;
  246.       var _loc2_ = 0;
  247.       while(_loc2_ < this["#15"].length)
  248.       {
  249.          if(this["#15"][_loc2_]["#34"] && this["#15"][_loc2_].getVolume() > 0)
  250.          {
  251.             this["#15"][_loc2_]["#64"](0,┬º#46┬º);
  252.          }
  253.          _loc2_ = _loc2_ + 1;
  254.       }
  255.    }
  256.    function ┬º#332┬º(┬º#46┬º)
  257.    {
  258.       this["#32"] = false;
  259.       var _loc2_ = 0;
  260.       while(_loc2_ < this["#12"].length)
  261.       {
  262.          if(this["#12"][_loc2_]["#34"])
  263.          {
  264.             this["#12"][_loc2_]["#64"](this["#77"],┬º#46┬º);
  265.          }
  266.          _loc2_ = _loc2_ + 1;
  267.       }
  268.    }
  269.    function ┬º#331┬º(┬º#46┬º)
  270.    {
  271.       this["#39"] = false;
  272.       var _loc2_ = 0;
  273.       while(_loc2_ < this["#15"].length)
  274.       {
  275.          if(this["#15"][_loc2_]["#34"])
  276.          {
  277.             this["#15"][_loc2_]["#64"](this.musicVolume,┬º#46┬º);
  278.          }
  279.          _loc2_ = _loc2_ + 1;
  280.       }
  281.    }
  282.    function ┬º#187┬º(┬º#375┬º, ┬º#120┬º, ┬º#46┬º)
  283.    {
  284.       if(this["#32"])
  285.       {
  286.          return undefined;
  287.       }
  288.       if(this["#12"][┬º#375┬º] == undefined)
  289.       {
  290.          eval("#0").log(this["#2"]() + "undefined sound " + ┬º#375┬º + ": " + this["#38"][┬º#375┬º]);
  291.       }
  292.       else
  293.       {
  294.          if(eval("#26")["#95"])
  295.          {
  296.             eval("#0").log(this["#2"]() + "playing sound " + ┬º#375┬º + ": " + this["#38"][┬º#375┬º] + ", volume " + this.getSoundVolume() + ", " + ┬º#120┬º + " loops");
  297.          }
  298.          if(┬º#120┬º == undefined || ┬º#120┬º < 1)
  299.          {
  300.             ┬º#120┬º = 1;
  301.          }
  302.          if(┬º#46┬º == undefined || ┬º#46┬º <= 0 || this["#32"])
  303.          {
  304.             this["#12"][┬º#375┬º].setVolume(this.getSoundVolume());
  305.             this["#12"][┬º#375┬º].start(0,┬º#120┬º);
  306.          }
  307.          else
  308.          {
  309.             this["#12"][┬º#375┬º].setVolume(0);
  310.             this["#12"][┬º#375┬º].start(0,┬º#120┬º);
  311.             this["#12"][┬º#375┬º]["#64"](this.getSoundVolume(),┬º#46┬º);
  312.          }
  313.       }
  314.    }
  315.    function ┬º#399┬º(┬º#189┬º, ┬º#120┬º, ┬º#46┬º)
  316.    {
  317.       if(this["#32"])
  318.       {
  319.          return undefined;
  320.       }
  321.       this["#187"](this.getSoundIDForName(┬º#189┬º),┬º#120┬º,┬º#46┬º);
  322.    }
  323.    function ┬º#263┬º(┬º#375┬º, ┬º#46┬º)
  324.    {
  325.       if(this["#12"][┬º#375┬º] == undefined)
  326.       {
  327.          eval("#0").log(this["#2"]() + "undefined sound " + ┬º#375┬º + ": " + this["#38"][┬º#375┬º]);
  328.       }
  329.       else
  330.       {
  331.          if(!this["#12"][┬º#375┬º]["#34"])
  332.          {
  333.             return undefined;
  334.          }
  335.          if(eval("#26")["#95"])
  336.          {
  337.             eval("#0").log(this["#2"]() + "stopping sound " + ┬º#375┬º + ": " + this["#38"][┬º#375┬º] + ", volume " + this["#12"][┬º#375┬º].getVolume() + " (" + this["#12"][0].getVolume() + ")");
  338.          }
  339.          if(┬º#46┬º == undefined || ┬º#46┬º <= 0)
  340.          {
  341.             this["#12"][┬º#375┬º].stop();
  342.          }
  343.          else
  344.          {
  345.             this["#12"][┬º#375┬º]["#64"](0,┬º#46┬º);
  346.          }
  347.       }
  348.    }
  349.    function ┬º#400┬º(┬º#189┬º, ┬º#46┬º)
  350.    {
  351.       this["#263"](this.getSoundIDForName(┬º#189┬º),┬º#46┬º);
  352.    }
  353.    function stopAllSounds(┬º#46┬º)
  354.    {
  355.       var _loc2_ = 0;
  356.       while(_loc2_ < this["#38"].length)
  357.       {
  358.          this["#263"](_loc2_,┬º#46┬º);
  359.          _loc2_ = _loc2_ + 1;
  360.       }
  361.    }
  362.    function getSoundIDForName(┬º#189┬º)
  363.    {
  364.       var _loc2_ = 0;
  365.       while(_loc2_ < this["#38"].length)
  366.       {
  367.          if(this["#38"][_loc2_] == ┬º#189┬º)
  368.          {
  369.             return _loc2_;
  370.          }
  371.          _loc2_ = _loc2_ + 1;
  372.       }
  373.       if(eval("#26")["#95"])
  374.       {
  375.          eval("#0").log(this["#2"]() + "getSoundIDForName couldn\'t find sound " + ┬º#189┬º);
  376.       }
  377.       return undefined;
  378.    }
  379.    function getSoundForName(┬º#189┬º)
  380.    {
  381.       return this["#12"][this.getSoundIDForName(┬º#189┬º)];
  382.    }
  383.    function ┬º#354┬º(┬º#46┬º)
  384.    {
  385.       if(this["#15"][this.currentMusic] == undefined)
  386.       {
  387.          eval("#0").log(this["#2"]() + "SoundManager: current music is undefined");
  388.          return undefined;
  389.       }
  390.       if(eval("#26")["#95"])
  391.       {
  392.          eval("#0").log(this["#2"]() + "playing music #" + this.currentMusic + " at volume " + this.getMusicVolume());
  393.       }
  394.       if(┬º#46┬º == undefined || ┬º#46┬º <= 0 || this["#39"])
  395.       {
  396.          this["#15"][this.currentMusic].setVolume(this.getMusicVolume());
  397.          this["#15"][this.currentMusic].start(0,9999);
  398.       }
  399.       else
  400.       {
  401.          this["#15"][this.currentMusic].setVolume(0);
  402.          this["#15"][this.currentMusic].start(0,9999);
  403.          this["#15"][this.currentMusic]["#64"](this.musicVolume,┬º#46┬º);
  404.       }
  405.    }
  406.    function ┬º#261┬º(┬º#46┬º)
  407.    {
  408.       if(┬º#46┬º == undefined || ┬º#46┬º <= 0)
  409.       {
  410.          this["#15"][this.currentMusic].stop();
  411.       }
  412.       else
  413.       {
  414.          this["#15"][this.currentMusic]["#64"](0,┬º#46┬º,true);
  415.       }
  416.    }
  417.    function setMusicByName(┬º#260┬º)
  418.    {
  419.       this.setMusic(this.getMusicIDForName(┬º#260┬º));
  420.    }
  421.    function setMusic(┬º#374┬º)
  422.    {
  423.       this.currentMusic = ┬º#374┬º;
  424.    }
  425.    function ┬º#329┬º(┬º#374┬º, ┬º#46┬º)
  426.    {
  427.       this["#261"](┬º#374┬º,┬º#46┬º);
  428.       this.setMusic(┬º#374┬º);
  429.       this["#354"](┬º#46┬º);
  430.    }
  431.    function getCurrentMusic()
  432.    {
  433.       return this["#15"][this.currentMusic];
  434.    }
  435.    function getMusicIDForName(┬º#260┬º)
  436.    {
  437.       var _loc2_ = 0;
  438.       while(_loc2_ < this["#66"].length)
  439.       {
  440.          if(this["#66"][_loc2_] == ┬º#260┬º)
  441.          {
  442.             return _loc2_;
  443.          }
  444.          _loc2_ = _loc2_ + 1;
  445.       }
  446.       eval("#0").log(this["#2"]() + "SoundManager: getMusicIDForName couldn\'t find music " + ┬º#260┬º);
  447.       return undefined;
  448.    }
  449.    function getMusicForName(┬º#260┬º)
  450.    {
  451.       return this["#15"][this.getMusicIDForName(┬º#260┬º)];
  452.    }
  453. }
  454.